package com.kizuki.io;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class TestChannel {

    /**
     * 1. 得到文件的输入通道
     * 2.FileChannel.open()静态方法获得通道
     */
    @Test
    public void test() throws IOException {
        FileInputStream inputStream = new FileInputStream("F:\\from.txt");

        FileChannel channel = inputStream.getChannel();

        FileChannel.open(Paths.get("F:\\to.txt"), StandardOpenOption.WRITE);
    }
}
